package com.hsh.gaoqianlianmeng.controller;

import com.hsh.gaoqianlianmeng.common.Result;
import com.hsh.gaoqianlianmeng.domain.Currency;
import com.hsh.gaoqianlianmeng.domain.ExchangeRate;
import com.hsh.gaoqianlianmeng.service.CurrencyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("currency")
public class CurrencyController {
    @Resource
    private CurrencyService currencyService;

    /**
     * 获取币种列表
     *
     * @return
     */
    @GetMapping("/getCurrency")
    public Result<List<Currency>> getCurrency() {
        return currencyService.getCurrency();
    }

    /**
     * 获取汇率
     *
     * @param exchangeRate
     * @return
     */
    @GetMapping("/getExchangeRate")
    public Result<ExchangeRate> getExchangeRate(ExchangeRate exchangeRate) {
        return currencyService.getExchangeRate(exchangeRate);
    }

}
